package pzl.com.photowalldemo.utils;

import android.content.Context;
import android.os.Environment;

import java.io.File;

/**
 * Created by zl.peng on 2016/11/3 22:00.
 */
public class SDUtil {
    ///sdcard/Android/data/<application package>/cache

    /**
     * @param context
     * @param uniqueName 分类类型：image,json,music...
     * @return
     */
    public static File getDiskCacheDir(Context context, String uniqueName) {
        String cachePath;
        if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())
                || !Environment.isExternalStorageRemovable()) {
            cachePath = context.getExternalCacheDir().getPath();
        } else {
            cachePath = context.getCacheDir().getPath();
        }
        return new File(cachePath + File.separator + uniqueName);
    }

}
